package com.bokesoft.yes.mid.auth;

import org.json.JSONObject;

import com.bokesoft.yigo.mid.auth.Login;
import com.bokesoft.yigo.mid.auth.Logout;
import com.bokesoft.yigo.mid.auth.base.IAuthenticator;
import com.bokesoft.yigo.mid.base.DefaultContext;
import com.bokesoft.yigo.mid.base.LoginInfo;
/**
 * setting.xml
 * <Setting>
 *     <Session AuthenticateProvider="com.bokesoft.yes.mid.auth.MyAuthenticator"/>
 * </Setting>   
 * @author USER
 *
 */
public class MyAuthenticator implements IAuthenticator<DefaultContext> {

	@Override
	public JSONObject login(DefaultContext context, LoginInfo loginInfo) throws Throwable {
		Login login = new Login(loginInfo);
		return login.doLogin(context);
	}

	@Override
	public void logout(DefaultContext context) throws Throwable {
		Logout logout = new Logout();
		logout.doLogout(context);
	}
	
}
